﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using System.Configuration;


namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建容器
            IUnityContainer myContainer = new UnityContainer();

            //从配置文件中获取注入对象
            UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
            section.Containers.Default.Configure(myContainer);

            //获取对象实例
            IWord logger = myContainer.Resolve<IWord>();

            //调用对象方法
            logger.WriteEng("测试");

            Console.Read();

        }
    }
}
